﻿#region Header

// <file>
//     <copyright see="prj:///doc/copyright.txt"/>
//     <license see="prj:///doc/license.txt"/>
//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
//     <version>$Revision: 2691 $</version>
// </file>

#endregion Header

namespace ICSharpCode.TextEditor.Document
{
    using System;

    public class LineCountChangeEventArgs : EventArgs
    {
        #region Fields

        IDocument document;
        int moved;
        int start;

        #endregion Fields

        #region Constructors

        public LineCountChangeEventArgs(IDocument document, int lineStart, int linesMoved)
        {
            this.document = document;
            this.start    = lineStart;
            this.moved    = linesMoved;
        }

        #endregion Constructors

        #region Properties

        /// <returns>
        /// always a valid Document which is related to the Event.
        /// </returns>
        public IDocument Document
        {
            get {
                return document;
            }
        }

        /// <returns>
        /// -1 if no offset was specified for this event
        /// </returns>
        public int LineStart
        {
            get {
                return start;
            }
        }

        /// <returns>
        /// -1 if no length was specified for this event
        /// </returns>
        public int LinesMoved
        {
            get {
                return moved;
            }
        }

        #endregion Properties
    }

    public class LineEventArgs : EventArgs
    {
        #region Fields

        IDocument document;
        LineSegment lineSegment;

        #endregion Fields

        #region Constructors

        public LineEventArgs(IDocument document, LineSegment lineSegment)
        {
            this.document = document;
            this.lineSegment = lineSegment;
        }

        #endregion Constructors

        #region Properties

        public IDocument Document
        {
            get { return document; }
        }

        public LineSegment LineSegment
        {
            get { return lineSegment; }
        }

        #endregion Properties

        #region Methods

        public override string ToString()
        {
            return string.Format("[LineEventArgs Document={0} LineSegment={1}]", this.document, this.lineSegment);
        }

        #endregion Methods
    }

    public class LineLengthChangeEventArgs : LineEventArgs
    {
        #region Fields

        int lengthDelta;

        #endregion Fields

        #region Constructors

        public LineLengthChangeEventArgs(IDocument document, LineSegment lineSegment, int moved)
            : base(document, lineSegment)
        {
            this.lengthDelta = moved;
        }

        #endregion Constructors

        #region Properties

        public int LengthDelta
        {
            get { return lengthDelta; }
        }

        #endregion Properties

        #region Methods

        public override string ToString()
        {
            return string.Format("[LineLengthEventArgs Document={0} LineSegment={1} LengthDelta={2}]", this.Document, this.LineSegment, this.lengthDelta);
        }

        #endregion Methods
    }
}